fix(cli): use wall-clock timestamp for repository announcement updates - #2901
Open
hsusul wants to merge 1 commit into
Open
fix(cli): use wall-clock timestamp for repository announcement updates#2901hsusul wants to merge 1 commit into
hsusul wants to merge 1 commit into
Conversation
Collaborator
|
🦾 DCO sign-off is failing on this PR. Each commit needs a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked Issue
Fixes #2876
Observed Failure
When executing
buzz repos protect setorbuzz repos protect removeon a repository announcement created more than 15 minutes ago, the relay rejects the event with:Root Cause
build_updated_repo_announcementincrates/buzz-cli/src/commands/repos.rsderived the replacement announcement event's timestamp strictly asexisting.created_at + 1.If the existing repo announcement was published more than 15 minutes ago, the derived timestamp
existing.created_at + 1was also more than 15 minutes in the past relative to server wall-clock time (now).The relay enforces
MAX_TIMESTAMP_DRIFT_SECS = 900(±15 minutes) on all ingested events, causing any update to an announcement older than 15 minutes to be rejected as stale.Implementation
Updated
build_updated_repo_announcementto calculate the replacement event's timestamp asnow.max(existing.created_at + 1):existing.created_atto satisfy NIP-33 parameterized replaceable event requirements.nowwhen updating older announcements, eliminating timestamp drift rejection at the relay.Regression Coverage
Added unit test
protection_update_uses_wall_clock_time_for_stale_repo_announcementsincrates/buzz-cli/src/commands/repos.rsverifying that repo announcements published in the past receive replacement timestamps matching current wall-clock time while advancing past the original timestamp.Exact Validation Commands & Results
. ./bin/activate-hermit && cargo test -p buzz-cli-> 251 tests passed. ./bin/activate-hermit && cargo fmt --all-> Clean formatting. ./bin/activate-hermit && just check-> Passed (clippy, formatting, desktop, web, and mobile checks clean)git diff --check-> Passed with no whitespace issuesLimitations or Untested Platforms
None.
Unrelated Changes
No unrelated changes were included.